import { Button, Typography } from "@mui/material";
import React, { useEffect } from "react";
import { useState } from "react";
import FindFail from "../../../components/FindFail";
import MyDialog from "../../../components/MyDialog";

export default function GetDetail(props) {
  const [open, setOpen] = useState(false);

  return (
    <div>
      <Button color="primary" onClick={() => setOpen(true)}>
        点击查看
      </Button>
      <MyDialog
        open={open}
        title={props.colDef.headerName}
        onClose={() => {
          setOpen(false);
        }}
      >
        {props.field == "detail" && (
          <Typography>
            {props?.value ?? <FindFail text="什么都没有" />}
          </Typography>
        )}
        {props.field == "participants" &&
          props.value.split("\n").map((value) => {
            return <Typography>{value}</Typography>;
          })}
      </MyDialog>
    </div>
  );
}
